<!-- 车间生产统计 -->
<template>
  <div class="container-workshop">
    <div class="content-wrap">
      <div class="flex-ac plt-10">
        <line-logo :name="$i18n.t('mesProduceStatistic.workshopProductionStatistics')" />
        <el-tooltip class="item" effect="dark" placement="top">
          <template #content>
            <span class="font-14">{{ $i18n.t("mesProduceStatistic.accordingToTheActualProductionDataOfTheWorkshop") }}</span>
          </template>
          <div class="query_icon ml-8">?</div>
        </el-tooltip>
      </div>
      <div class="scroll-wrap" v-if="workshopStatistics.length">
        <div v-for="(row, index) in workshopStatistics" :key="index" class="workshop-wrap">
          <div class="workshop-name flex-j-sb">
            <span>{{ row.workshopName }}</span>
            <div class="flex-j-sa w-50">
              <div class="flex-col">
                <div class="fw-600">{{ row.finishnum }}</div>
                <div>{{ $i18n.t("mesProduceStatistic.finished") }}</div>
              </div>
              <div class="flex-col">
                <div class="fw-600">{{ row.ngnum }}</div>
                <div>{{ $i18n.t("mesProduceStatistic.abnormal") }}</div>
              </div>
              <div class="flex-col">
                <div class="fw-600">{{ row.dropnum }}</div>
                <div>{{ $i18n.t("mesProduceStatistic.scrapped") }}</div>
              </div>
              <div class="flex-col">
                <div class="fw-600">{{ row.typenum }}</div>
                <div>{{ $i18n.t("mesProduceStatistic.specifiedProduct") }}</div>
              </div>
              <div class="flex-col">
                <div class="fw-600" :style="{ color: row.passrate == 100 ? '' : 'red' }">{{ row.passrate + '%' || $i18n.t('mesProduceStatistic.noData') }}</div>
                <div>{{ $i18n.t("mesProduceStatistic.passRate") }}</div>
              </div>
            </div>
          </div>
          <template v-if="row.list.length">
            <div v-for="(li, i) in row.list" :key="i" class="progress-wrap">
              <div>
                <span class="fw-600">{{ li.lineName || $i18n.t('mesProduceStatistic.noData') }}</span>
                <span>{{ $i18n.t('mesProduceStatistic.completedCount') }}：{{ li.finishnum || '0' }}</span>
                <span>{{ $i18n.t('mesProduceStatistic.abnormalQuantity') }}：{{ li.ngnum || '0' }}</span>
                <span>{{ $i18n.t('mesProduceStatistic.scrapCount') }}：{{ li.dropnum || '0' }}</span>
                <span>{{ $i18n.t('mesProduceStatistic.productCount') }}：{{ li.typenum || '0' }}</span>
              </div>
              <el-progress :percentage="li.passrate" :stroke-width="10"></el-progress>
            </div>
          </template>
          <div v-else class="empty">{{ $i18n.t("mesProduceStatistic.noData") }}</div>
        </div>
      </div>
      <el-empty v-else :image-size="200"></el-empty>
    </div>
  </div>
</template>
<script>
import LineLogo from './line-logo.vue'
export default {
  name: '',
  components: { LineLogo },
  props: {
    workshopStatistics: {
      type: Array,
      default: []
    }
  }
}
</script>
<style scoped lang="scss">
.container-workshop {
  background: #fff;
  width: calc(50% - 5px);
  height: 450px;
  margin-top: 12px;

  .content-wrap {
    height: 100%;
    padding: 12px 0;
  }

  .plt-10 {
    padding: 0 10px;
  }

  .flex-j-sb {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .flex-j-sa {
    display: flex;
    align-items: center;
    justify-content: space-around;
  }

  .flex-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 13px;
  }

  .flex-ac {
    display: flex;
    align-items: center;
  }

  .w-50 {
    width: 50%;
  }

  .workshop-wrap {
    padding-top: 10px;
  }

  .scroll-wrap {
    height: calc(100% - 20px);
    padding: 0 12px;
    overflow-y: auto;
  }

  .workshop-name {
    width: 100%;
    padding: 6px 12px;
    border-radius: 4px;
    background: #eee;
    font-size: 13px;
  }

  .progress-wrap {
    padding: 10px 25px;
    font-size: 12px;

    span {
      margin-right: 12px;
    }
  }

  .empty {
    font-size: 12px;
    padding: 10px 25px;
  }

  .fw-600 {
    font-weight: 600;
  }

  .query_icon {
    width: 16px;
    height: 16px;
    background: #93b0cb;
    opacity: 1;
    font-size: 12px;
    color: #ffffff;
    text-align: center;
    line-height: 16px;
    border-radius: 50%;
    cursor: pointer;
  }

  /deep/.el-progress-bar {
    width: 98%;
  }
}
</style>
